package la.bbs558.controller.admin;

import cn.dev33.satoken.annotation.SaCheckRole;
import la.bbs558.aop.valid.Valid;
import la.bbs558.controller.base.BaseController;
import la.bbs558.controller.base.Result;
import la.bbs558.entity.params.ExclusiveVisitRecordPage;
import la.bbs558.entity.params.UserDataForAdminPage;
import la.bbs558.entity.params.UserVisitCollectPage;
import la.bbs558.satoken.StpAdminUtil;
import la.bbs558.service.ExclusiveVisitRecordService;
import la.bbs558.service.UserDataService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

 /**
 * 用户数据统计
 * @author: Shanks
 * @date: 2024/1/19 18:39
 * @desc:
 */
@RestController
@RequestMapping("/admin/userData")
@SaCheckRole(value = { "admin" },type = StpAdminUtil.TYPE)
public class UserDataManageController extends BaseController {

    @Resource
    private UserDataService userDataService;

    @Resource
    private ExclusiveVisitRecordService exclusiveVisitRecordService;

    /**
     * 统计列表
     * @param page
     * @return
     */
    @GetMapping("list")
    public Result<?> list(UserDataForAdminPage page) {
        userDataService.getListForAdmin(page);
        return Result.success(page);
    }

    /**
     * 详情
     * @param page
     * @return
     */
    @GetMapping("detailList")
    public Result<?> detailList(@Valid ExclusiveVisitRecordPage page) {
        exclusiveVisitRecordService.getListForAdmin(page);
        return Result.success(page);
    }

     /**
      * 查询访问用户收集信息列表
      */
     @GetMapping("visit/collect/list")
     public Result<?> visitCollectList(UserVisitCollectPage page) {
         page = userDataService.getVisitCollectPageForAdmin(page);
         return Result.success(page);
     }
}
